package com.cskaoyan.wordmemorize.controller.app;

import com.cskaoyan.wordmemorize.auth.StpKit;
import com.cskaoyan.wordmemorize.common.result.Result;
import com.cskaoyan.wordmemorize.dto.app.DisplayUserLevelDTO;
import com.cskaoyan.wordmemorize.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user/level")
public class UserLevelController {

    @Autowired
    UserService userService;

    @GetMapping("/info")
    public Result getUserLevelInfo() {
        Long userId = StpKit.USER.getLoginIdAsLong();
        DisplayUserLevelDTO userLevelInfo = userService.getUserLevelInfo(userId);
        return Result.ok(userLevelInfo);
    }
}
